//
//  BCHttpResponseModel.h
//  BCBaseNetworking
//
//  Created by Basic on 16/3/22.
//  网络请求 response 通用基类
//

#import <BCModel/BCModel.h>


//消息提示类型
#define kBCHttpResponse_MsgTypeNone     0//隐藏提示消息
#define kBCHttpResponse_MsgTypeAlert    1//alert消息
#define kBCHttpResponse_MsgTypeToast    2//toast消息
//按钮行为
#define kBCHttpResponse_BtnTypeClose    101//按钮行为，关闭弹窗
#define kBCHttpResponse_BtnTypeReSubmit 102//按钮行为，重新请求
#define kBCHttpResponse_BtnTypePush     103//按钮行为，链接跳转
#define kBCHttpResponse_BtnTypePop      104//按钮行为，返回上一级

#pragma mark - response 提示消息

@protocol BCHttpResponseMsgModel
@end

NS_ASSUME_NONNULL_BEGIN

@interface BCHttpResponseMsgModel : NSObject<BCModel>
/// 1 表示 alert提示，2:toast 提示，见宏 kBCHttpResponse_MsgTypeAlert
@property (nonatomic, assign) NSInteger type;
/// 按钮列表
@property (nonatomic, strong, nullable) NSArray      <NSString *> *buttonNameList;
/// 按钮数量
@property (nonatomic, assign) NSInteger buttonNums;

/// 提示标题
@property (nonatomic, strong, nullable) NSString *title;
/// 提示内容
@property (nonatomic, strong, nullable) NSString *message;
/// 提示图片 url
@property (nonatomic, strong, nullable) NSString *img;
/// 业务 url
@property (nonatomic, strong, nullable) NSString *url;
/// 确关闭弹窗:101 重新请求:102 链接跳转:103，见宏 kBCHttpResponse_BtnTypeClose
@property (nonatomic, assign) NSInteger confirmType;

//自定义参数
/// 是否显示过提示，防止重复显示，默认NO
@property (nonatomic, assign) BOOL isShow;

///  提示消息是否可以展示，默认有title、content任何一项就可以展示
- (BOOL)canShow;
@end

#pragma mark - response
@interface BCHttpResponseModel : NSObject<BCModel>
//基础数组
/// 原始的网络 code
@property (nonatomic, assign) NSInteger bc_statusCode;
/// response 数据
@property (nonatomic, strong) NSDictionary *bc_data;
/// response erro 数据
@property (nonatomic, strong, nullable) NSError *bc_error;

//response data下的字段
@property (nonatomic, copy, nullable) NSString *message;
/// 时间
@property (nonatomic, copy, nullable) NSString *time;
/// 业务code
@property (nonatomic, strong, nullable) NSNumber *code;
/// 业务是否成功
@property (nonatomic, assign) BOOL success;

/// 提示消息model
@property (nonatomic, strong) BCHttpResponseMsgModel *popup;

#pragma mark - public
- (void)bc_loadDefaultResponse;
@end


NS_ASSUME_NONNULL_END
